package WaiBao;

import java.util.Arrays;

public class TaoYiJu {
    public static void main(String[] args) {
        String[] name = {"陈楚生(班长)", "付辛博(副班长)", "小李(学习委员)", "井柏然(纪律委员)", "乔任梁(体育委员)", "王锁杏", "马天宇", "张天爱", "胡连彬", "胡彦斌", "薛之谦", "月返利",
                "保剑锋", "宋晓波", "王宝强", "王祖蓝", "陈奕迅", "陈冠希", "欧豪", "高云翔", "肖战", "易烊千玺", "样样", "李佳航", "鹿晗", "黄子韬", "欧豪2", "吴京",
                "刘德华", "陶艺菊(学生)"};//最后一位考生本人: 陶艺菊(学生)
        int[] Age = {19, 21,21,20, 22, 22, 18, 22, 20, 20, 18, 21, 18,21, 20, 19, 18, 18, 18, 18,20, 19, 20, 20, 20, 20, 19, 21, 20, 20};//考生年龄：20岁

        double[]  haodi1 = {97, 84, 93, 80, 71, 87, 73, 49, 82, 90, 91, 87, 85, 79, 65, 68, 64, 79, 96, 88, 92, 91, 95, 88, 65, 74, 77, 74, 84, 96};
        double[]  haodi2 = {77, 84, 77, 70, 80, 91, 71, 74, 91, 75, 90, 70, 86, 76, 65, 68, 86, 79, 66, 68, 92, 71, 95, 85, 79, 84, 79, 66, 91, 96};
        double[]  haodi3 = {76, 98, 90, 81, 71, 64, 76, 79, 85, 60, 94, 87, 85, 75, 85, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 72, 71, 85, 96};

        double yuan1;//代表每个学生的总分
        double yuan2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            yuan1 = (haodi1)[i] + haodi2[i] +haodi3[i];
//            yuan2 = ( yuan1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + yuan1);
//            System.out.println(name[i] + "的平均分为:" + yuan2);
//        }


        double banban1 = 0, banban2 = 0;
        double[] diyu = new double[30];
//        for (int i = 0; i < 30; i++) {
//            banban1  =haodi1[i] + haodi2[i] + haodi3[i];
//            banban2 = (banban1 * 1.0) / 3;
//            diyu[i] = banban2;
//        }
//
//        for (int i = 0; i < diyu.length - 1; i++) {
//            for (int j = 0; j < diyu.length - i - 1; j++) {
//                if (diyu[j] < diyu[j + 1]) {
//                    double tep = diyu[j];
//                    diyu[j] =diyu[j + 1];
//                    diyu[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(diyu[i]);
//        }




        double hanghai1 = 0,hanghai2 = 0,hanghai3 = 0;//计算每门课的平均分
        double dashu1 = 0,dashu2 = 0,dashu3 = 0;//计算每门课标准差
        double butong1 = 0,butong2 = 0, butong3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < haodi1.length; i++) {
            sum2+=haodi1[i];
        }
        hanghai1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ hanghai1);
        double Sum = 0;
        for (int i = 0; i < haodi2.length; i++) {
            Sum+=haodi2[i];
        }
        hanghai2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+hanghai2);
        double sum = 0;
        for (int i = 0; i <haodi3.length; i++) {
            sum+=haodi3[i];
        }
        hanghai3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ hanghai3);


//////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <haodi1.length; i++) {
            c1+= (haodi1[i] -hanghai1)*(haodi1[i] - hanghai1);
        }
        dashu1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+dashu1);

        for (int i = 0; i < haodi2.length; i++) {
            c2+= (haodi2[i] - hanghai2)*(haodi2[i] -hanghai2);
        }
        dashu2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+dashu2);

        for (int i = 0; i < haodi3.length; i++) {
            c3+= (haodi3[i] - hanghai3)*(haodi3[i] - hanghai3);
        }
        dashu3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+dashu3);
////////////
//////////////
//        Arrays.sort(haodi1);
//        Arrays.sort(haodi2);
//        Arrays.sort(haodi3);
//        butong1 =( haodi1[14]+haodi1[15])*1.0/2;
//        butong2 =(haodi2[14]+haodi2[15])*1.0/2;
//        butong3 =( haodi3[14]+haodi3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+butong1);
//        System.out.println("微生物学的中位数为:"+butong2);
//        System.out.println("人体组织解剖学的中位数为:"+butong3);


    }
}
